import java.util.List;

public  class lk19{
    //删除链表的某一结点
    ListNode dummy = new ListNode(0,head);
    int length = getlength(head);
    ListNode cur =dummy;
    for(int i=0;i<length-n+1;i++){
        cur = cur.next;
    }
    cur.next=cur.next.next;
    ListNode ans=dummy.next;
    return ans;
    //求解链表长度
    public int getlength(ListNode head){
        int length=0;
        while (head !=null){
            ++length;
            head =head.next;
        }
        return length;
    }
}